<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s"  uri="/struts-tags"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'BillsList.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
 <c:if test="${empty BillTypelist}">
    <c:redirect url="BillsAction.action"></c:redirect>
 </c:if>
  <body>
  <form action="QuryAction.action" method="post">
     <table>
        <tr>
           <td> 类型：<select name="type" >
                         <option>不限</option>
                         <s:iterator value="BillTypelist" id="BillType">
                             <option value="<s:property value="id" />"><s:property value="name"/></option>
                         </s:iterator>
                  </select>
          </td>
          <td>时间：从<input name="bengintime"></td>
          <td>到<input name="endtime"></td>
          <td><input type="submit" value="搜索"></td>
          <td><a href="AddBills.jsp"><input type="button" value="记账"></a></td>
        </tr>
        
          <tr>
          <td><strong>标题</strong></td>
          <td><strong>记账时间</strong></td>
          <td><strong>类别</strong></td>
          <td><strong>金额</strong></td>
          <td><strong>说明</strong></td>
          </tr>
          
          <s:if test="quryBills==null || quryBills==''">
          
              <tr>
              
                <td><h1>没有找到任何账单</h1></td>
              </tr>
          </s:if>
          <s:else>
          <s:iterator value="quryBills" id="Bills">
             <tr>
                <td><s:property value="title"/></td>
                <td><s:date name="billTime"/></td>
                <td>
                   <s:property value="billType.name"/>
                </td>
                <td>
                <s:if test="billType.name=='支出' || billType.name=='借出' || billType.name=='还出' ">
                   -<s:property value="price"/>
                </s:if>
                <s:else>
                  +<s:property value="price"/>
                </s:else>
                
                
                </td>
                <td><s:property value="explain"/></td>
             </tr>
          </s:iterator>
          </s:else>
     </table>
     
  </form>
  
  </body>
</html>
